﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="cal_events.aspx.cs" Inherits="cal_events" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-EN" style="width: 100%;
height: 100%;">
<head id="Head1" runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <script type='text/javascript' src="assets/jquery/jquery-1.5.2.min.js"></script>
    <script type='text/javascript' src="assets/jquery/jquery-ui-1.8.22.min.js"></script>
    <script type='text/javascript' src='Assets/jquery/simple_colorpicker.js'></script>
    <script type='text/javascript' src="assets/js/jquery.autocomplete.js"></script>
    <script type='text/javascript' src="assets/js/timepicker.js"></script>
    <link rel="stylesheet" type="text/css" href="assets/css/jquery.autocomplete.css" />
    <script type='text/javascript' src='Assets/jquery/simple_colorpicker.js'></script>
    <script type="text/javascript">
        function rgb2hex(rgb) {
            rgb = rgb.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+))?\)$/);
            function hex(x) {
                return ("0" + parseInt(x).toString(16)).slice(-2);
            }
            return "#" + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);
        }

        $(function () {
            $('#ColorPicker1').empty().addColorPicker({
                clickCallback: function (elem, c) {
                    $('#ColorSelectionTarget1').css('background-color', c);
                    $('#txtColor').val(rgb2hex(c));
                }

            });
        });

        $(document).ready(function () {
            $("#datepicker_startdate").datepicker({ dateFormat: "yy-mm-dd" });
            $("#datepicker_enddate").datepicker({ dateFormat: "yy-mm-dd" });
            $('#timepicker_startdate').focus().autocomplete(timepicker);
            $('#timepicker_enddate').focus().autocomplete(timepicker);

            $('#categorytab').bind('tabsselect', function (event, ui) {
                $("#txtTabID").get(0).value = ui.index + 1;
            });
        });

        function doOpenEdit(sId) {
            var value = $("#txtTabID").val();
            if (value == "3") {
                window.location.href = "Notes.aspx?action=add&type=" + value;
            }
            else {
                if (value == "1" || value == "4" || value == "5")
                    alert("Không tạo được ở Tab này");
                else
                    window.location.href = "cal_events.aspx?action=add&type=" + value;
            }
        }
        function getUrlVars() {
            var vars = [], hash;
            var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
            for (var i = 0; i < hashes.length; i++) {
                hash = hashes[i].split('=');
                vars.push(hash[0]);
                vars[hash[0]] = hash[1];
            }
            return vars;
        }

        $(document).ready(function () {
            var tid = getUrlVars()["tid"];
            if (!tid) {
                tid = "1";
                $("#categorytab").tabs("select", tid);
            }
            else {
                tid = tid.replace("#", "");
                var $tabs = $('#categorytab').tabs();
                $tabs.tabs('select', tid);
                if (tid == "4")
                    $(".divhistory").slideToggle("slow");
                $("#categorytab").tabs("select", tid);
                if (tid == "3") $("#txtInputNote").focus();

            }
            //$("#txtTabID").get(0).value = tid;
            $('#categorytab').bind('tabsselect', function (event, ui) {
                $("#txtTabID").get(0).value = ui.index + 1;
                if ($("#txtTabID").val() == 1)
                    $("#inputNote").show();
                else
                    $("#inputNote").hide();
            });
        });

        $(document).ready(function () {
            $('.box').show();
            $('#drTimeUnit').change(function () {
                $('.box').hide();
                $('#div' + $(this).val()).show();
            });
            if ($("#txtTabID").val() == 1) {
                $("#inputNote").show();
            }
            else
                $("#inputNote").hide();

            $('input').keydown(function (e) {
                if (e.keyCode == 13) {
                    $('#btnSaveNote').click();
                }
            });
        });
    </script>
    <link rel="stylesheet" type="text/css" href="assets/jquery/style.css">
    <style>
        input[type=checkbox]
        {
            cursor: pointer;
        }
        .ui-tabs .ui-tabs-panel
        {
            padding: 0 !important;
        }
        .ui-widget-content h4
        {
            padding: 0 !important;
            margin: 0;
        }
        #categorytab
        {
            color: #000;
            border: 1px solid #ccc;
            border-top: 1px;
            width: 100%;
            height: 100%;
            padding-bottom: 10px;
            margin-bottom: 10px;
            font-family: arial;
            float: left;
        }
        #categorytab ul
        {
            float: left;
            list-style-image: none;
            list-style-type: none;
            margin: 0;
            padding: 0;
            width: 100%;
        }
        #categorytab .nav_header
        {
            width: 100%;
            float: left;
        }
        #categorytab .nav_header h4
        {
            float: left;
            width: 100%;
            padding: 0 !important;
        }
        #categorytab ul li
        {
            float: left;
        }
        #categorytab ul li a
        {
            color: #000;
            background-color: #ABBBCB;
            font-family: arial;
            font-size: 12px;
            font-weight: bold;
            float: left;
            text-align: center;
            text-decoration: none;
            text-transform: none;
            padding: 5px 11px;
        }
        #categorytab ul li a:hover
        {
            color: #FFF;
            background-color: #459300;
            text-decoration: none;
        }
        #categorytab ul li.ui-tabs-selected a
        {
            color: #FDD901;
            background-color: #459300;
        }
        #categorytab .tab_content
        {
            float: left;
            width: 100%;
            height: 100%;
        }
        #categorytab .ui-tabs-hide
        {
            display: none;
        }
        .tabs-articles
        {
            float: left;
            height: auto;
            width: 99%;
            padding-left: 8px;
            padding-top: 8px;
            font-family: Arial;
            font-size: 12px;
            font-weight: normal;
            color: #000;
        }
        .tabs-articles-name
        {
            float: left;
            height: auto;
            width: 100%;
        }
        .tabs-articles-name a
        {
            font-weight: bold;
            text-decoration: none;
            color: #000;
        }
        .tabs-articles-name a:hover
        {
            text-decoration: underline;
        }
        .tabs-articles-image
        {
            float: left;
            padding: 5px;
        }
        .tabs-articles-summary
        {
            float: left;
            width: 90%;
            padding: 5px;
            height: auto;
        }
        .tabs-articles-relatedname
        {
            background-image: url(/assets/NewStar004/images/related-link-bg.png);
            background-repeat: no-repeat;
            background-position: 30px center;
            width: 100%;
            height: 12px;
            line-height: 12px;
            float: left;
            text-indent: 40px;
        }
        .tabs-articles-relatedname a
        {
            text-decoration: none;
            font-weight: bold;
            color: #000;
        }
        .tabs-articles-relatedname a:hover
        {
            text-decoration: underline;
        }
        
        input[type="text"]:focus
        {
            outline: none;
            box-shadow: 0px 0px 5px #61C5FA;
            border: 1px solid #4488cc;
            background-color: #FCFFC5 !important;
            border-radius: 0;
        }
    </style>
</head>
<body style="width: 100%; height: 100%;">
    <%if (Request.QueryString["action"] != null && Request.QueryString["action"] != "")
      { %>
    <link href="assets/jquery/jquery-ui.css" rel="stylesheet" type="text/css" />
    <form id="Form1" runat="server">
    <div style="width: 100%; height: auto;">
        <div id="error_message">
        </div>
        <%if (Request.QueryString["type"].ToString() == "1" && (Request.QueryString["CustID"] != null && Request.QueryString["CustID"].ToString() != ""))
          {
              lblName.Text = "Mô tả giao tiếp";
              lblDes.Text = "Kế hoạch đeo đuổi";
        %>
        <div style="float: left; padding: 5px 0 0 0;">
            <span style="float: left; font-weight: bold;">Khách hàng</span>:<br />
            <asp:TextBox type="text" Style="width: 370px;" name="txtCustormer" ID="txtCustormer"
                ReadOnly="true" value="" runat="server"></asp:TextBox>
        </div>
        <%} %>
        <div style="float: left; padding: 0;">
            <span style="float: left;">
                <asp:Label ID="lblName" runat="server" Text="Tên" Style="font-weight: bold;"></asp:Label>:</span>
            <br />
            <textarea type="text" id="txtName" style="vertical-align: top; width: 370px; height: 36px;
                font-size: 12px;" runat="server" readonly="true"></textarea>
        </div>
        <div style="float: left; padding: 5px 0 5px 0;">
            <span style="float: left;">
                <asp:Label ID="lblDes" runat="server" Text="Mô tả" Style="font-weight: bold;"></asp:Label>:
            </span>
            <br />
            <textarea type="text" id="txtDescripton" style="vertical-align: top; width: 370px;
                font-size: 12px; height: 18px;" runat="server" readonly="true"></textarea>
        </div>
        <div style="float: left; padding: 5px 0 0 0; display: none;">
            <span style="float: left; font-weight: bold;">Khoảng thời gian: </span>
            <asp:DropDownList ID="drTimeUnit" runat="server">
                <asp:ListItem Value="1">Đầu giờ sáng</asp:ListItem>
                <asp:ListItem Value="2">Cuối giờ sáng</asp:ListItem>
                <asp:ListItem Value="3">Đầu giờ chiều</asp:ListItem>
                <asp:ListItem Value="4">Cuối giờ chiều</asp:ListItem>
                <asp:ListItem Value="5">Đầu tuần</asp:ListItem>
                <asp:ListItem Value="6">Giữa tuần</asp:ListItem>
                <asp:ListItem Value="7">Cuối tuần</asp:ListItem>
                <asp:ListItem Value="8">Đầu tháng</asp:ListItem>
                <asp:ListItem Value="9">Giữa tháng</asp:ListItem>
                <asp:ListItem Value="10">cuối tháng</asp:ListItem>
                <asp:ListItem Value="11">Đầu năm</asp:ListItem>
                <asp:ListItem Value="12">Giữa năm</asp:ListItem>
                <asp:ListItem Value="13">Cuối năm</asp:ListItem>
                <asp:ListItem Value="14" Selected="True">Chính xác</asp:ListItem>
            </asp:DropDownList>
        </div>
        <div style="float: left; padding: 5px 0 0 0; width: 300px;" id="div14" class="box">
            <div style="float: left; padding: 5px; font-weight: bold;">
                <span style="">Timing</span>
            </div>
            <div style="float: left; padding-left: 0px;">
                <asp:TextBox type="text" Style="width: 76px;" name="datepicker_startdate" ID="datepicker_startdate"
                    value="" runat="server"></asp:TextBox>
                <asp:TextBox type="text" Style="width: 50px;" name="timepicker_startdate" ID="timepicker_startdate"
                    value="" runat="server"></asp:TextBox>
            </div>
            <div style="float: right;">
                <asp:Button ID="btnSave" runat="server" Text="Cập nhật" class="button" OnClick="btnSave_Click" />
            </div>
        </div>
        <%if (nSuperPermissions >= 7)
          {%>
        <div style="float: left; padding: 5px 0 0 0; display: none;">
            <span style="float: left;">File Upload: </span>
            <input id="FileInput" type="file" width="350px" name="File1" runat="server">
        </div>
        <%if (Request.QueryString["type"].ToString() == "3")
          { %>
        <div style="float: left; padding: 5px 0 0 0;">
            <span style="float: left;">Giao việc cho: </span>
            <asp:DropDownList ID="drAdminUser" runat="server">
            </asp:DropDownList>
        </div>
        <%} %>
        <div style="float: left; padding: 5px 0 0 0; width: 350px;">
            <asp:Label ID="lbdownload" runat="server"></asp:Label></div>
        <%} %>
        <div class="clear">
        </div>
        <div style="float: left; padding: 5px 0 0 0; width: 100%;">
            <%--<a href="cal_events.aspx" class="button">Quay lại</a>--%>
            <%-- <asp:Button ID="btnSave" runat="server" Text="Cập nhật" class="button" OnClick="btnSave_Click" />--%>
        </div>
    </div>
    </form>
    <%}
      else
      { %>
    <script type='text/javascript' src="assets/js/jquery-tab.min.js"></script>
    <div id="categorytab" class="categorytab_LRQKQQHVGLVXVNKIH title_fontend">
        <form id="Form2" runat="server">
        <input type="hidden" id="txtTabID" name="txtTablID" runat="server" value="1" />
        <div class="nav_header title_fontend">
            <div style="float: left;">
                <ul class="clear">
                    <li class=""><a href="ajaxfile/Event.aspx?tid=3&type=2" class="title_fontend" title="cattab3">
                        Note</a></li>
                    <li class=""><a href="ajaxfile/Event.aspx?tid=1&type=1&timeunit=true" class="title_fontend"
                        title="cattab1">Cơ hội bán hàng</a></li>
                    <%--<%if (nSuperPermissions > 0)
                      { %>
                    <li class=""><a href="ajaxfile/Event.aspx?tid=2&type=2" class="title_fontend" title="cattab2">
                        Sự kiện</a></li>
                    <%} %>--%>
                    <%--<li class=""><a href="ajaxfile/Event.aspx?tid=1" class="title_fontend" title="cattab3">
                        All</a></li>
                    <li class=""><a href="ajaxfile/Event.aspx?tid=4&status=-1<%if (Request.QueryString["ev"] != null)
                      { %>&ev=<%Response.Write(Request.QueryString["ev"].ToString()); %><%} %>" class="title_fontend"
                        title="cattab4">History</a></li>--%>
                </ul>
            </div>
            <div style="float: right; padding-right: 30px; font-weight: bold; font-size: 11px;">
                <asp:CheckBox ID="cbNotifStatus" runat="server" OnCheckedChanged="cbNotifStatus_CheckedChanged"
                    AutoPostBack="true" />NOTIFICATION
            </div>
            <%-- <div style="float: right; position: absolute; right: 20px;">
                <a href="#" id="btAdd" class="button" onclick="doOpenEdit();">ADD</a>
            </div>--%>
        </div>
        <div id="inputNote">
            <asp:TextBox ID="txtInputNote" Text="" runat="server" Style="width: 400px; border-radius: 10px;
                border: 1px solid; height: 25px; margin: 10px 5px 4px 5px;"></asp:TextBox>
            <asp:Button ID="btnSaveNote" runat="server" Style="display: none" Text="Button" OnClick="btnSaveNote_Click" />
        </div>
        </form>
        <div id="cattab1" class="tab_content title_fontend">
        </div>
        <div id="cattab3" class="tab_content title_fontend">
        </div>
        <div class="clr">
        </div>
    </div>
    <div class="clr">
    </div>
    <script type="text/javascript">
        jQuery(document).ready(function ($) {
            $('#categorytab').tabs();
        });      
    </script>
    <div class="clear">
    </div>
    <%} %>
</body>
</html>
